<%@ page contentType="text/html;charset=UTF-8" %>
<%--<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>--%>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>登录界面</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div id="app" class="container">
    <div class="row">
        <div class="col-md-4"></div>
        <%--<form action="/demo/Pay/add" method="post">--%>
            <div class="col-md-4">
                <p class="h1 text-center">增加</p>
                <div>
                    <input type="text" name="stuId" class="form-control" v-model="paymentM.stuId" placeholder="学号">
                </div>
                <br>
                <div>
                    <input type="text" name="term" class="form-control" v-model="paymentM.term" placeholder="学期">
                </div>
                <br>
                <div>
                    <input type="text" name="clazz" class="form-control" v-model="paymentM.clazz" placeholder="班级">
                </div>
                <br>
                <div>
                    <input type="text" name="name" class="form-control" v-model="paymentM.name" placeholder="姓名">
                </div>
                <br>
                <div>
                    <input type="text" name="payment" class="form-control" v-model="paymentM.payment" placeholder="缴费情况">
                </div>
                <br>
                <div>
                    <input type="text" name="arrearage" class="form-control" v-model="paymentM.arrearage" placeholder="欠费情况">
                </div>
                <br>
                <button type="submit" @click="add()" class="btn btn-info btn-block" >提交</button>
            </div>
        <%--</form>--%>
        <div class="col-md-4">
        </div>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script src="/static/js/vue.js"></script>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            paymentM: {
                stuId: null,
                term: null,
                clazz: '',
                name: '',
                payment: '',
                arrearage: '',
            },
            result: ''

        },
        methods: {
            add:function () {
                $.ajax({
                    url:'/demo/Pay/add',
                    // url:'https://www.baidu.com',
                    type:'POST',
                    contentType:'application/json',
                    data:JSON.stringify(app.paymentM),
                    dataType:'json',
                    // data:{"stuInfo":this.stuInfo},
                    success:function(result){
                        this.result = result;
                        var url = '/demo/Pay/gotoget';
                        if(result.indexOf("成功")>=0){
                            window.location.href='/demo/stuInfo/success?result='+this.result+'&url=' + url;
                        }else{
                            window.location.href= '/demo/stuInfo/error?result='+this.result+'&url=' + url;
                        }
                    }
                });
            }
        }
    });
</script>
</body>
</html>